Miles Sound System SDK 7.2a

The RAD_IOP API for the Sony PS2

Discussion

There are several chips in the Sony PS2. The EE is the primary chip that your game (and the RAD SDKs) run on. There is also the IOP which is in charge of I/O and sound control. The RAD_IOP API provides a high-level interface from the EE to control the IOP.

The RAD IOP layer is designed to do four things:

1) Asynchronous file I/O on the EE. You can request async file reads to execute in the background, and RAD_IOP will tell the IOP to go off and do them for you. The destination of these reads can be a memory location on the EE, the IOP, or the SPU. You can one flag, and the data goes somewhere else automatically. You can then get a callback, or just check a status field to determine when the read completes. This is the API that the RAD SDKs use to do it's file I/O, but you can use it for your own I/O too.

2) PCM sound streaming. You can request that RAD_IOP start a streaming buffer, and it will call you back on an interrupt to fill the buffer. You simply copy your sound into the buffer in each interrupt. This is the API that the RAD SDKs use to play sound, but like the I/O API, you can use it to play your own sound as well.

3) Drift-free timer services. You can request that RAD_IOP start calling a function callback at a certain timer frequency. They are drift-free in the sense that we monitor how long between each callback and will call you less and more often to maintain the exact callback frequency you requested.

4) Play ADPCM audio on the Sony PS2 audio hardware (see the next section).

The RAD_IOP layer was designed to run along side any other EE or IOP modules, so you can let the RAD SDKs use this API by itself, or your game can use it and save you a little work.

The next sections describe the functions in this handy API.

The RAD_IOP API for the Sony PS2
RAD_IOPStartUp opens the RAD_IOP API for use.
SOUND_CORE_FLAGS Specifies the sound flags that RAD_IOP should use.
RAD_IOPMemoryAmount returns the amount of IOP memory in bytes that RAD_IOP will need.
RAD_IOPShutDown closes the RAD_IOP library.
RAD_IOPQueueAsyncOpenFile asynchronously opens a file handle.
RAD_IOP_ASYNC_OPEN_DATA is a structure used with the RAD_IOPQueueAsyncOpenFile function.
RAD_IOP_STATUS_VALUES Specifies the status values for the RAD_IOP asynchronous I/O functions.
RAD_IOP_OPENCALLBACK points to a function that will be called when the async open file completes.
RAD_IOPGetFileHandleToIOPMemory creates a file handle that can be used to read from IOP memory.
RAD_IOPGetFileHandleToSPUMemory creates a file handle that can be used to read from SPU memory.
RAD_IOPGetFileHandleToLSN creates a file handle that directly address a Logical Sector Number on a CD or DVD.
RAD_IOPQueueAsyncReadAtTop queues an asynchronous read to be performed in the background at the highest priority.
RAD_IOP_ASYNC_READ_DATA is a structure used to perform an asynchronous read.
RAD_IOP_ADDRESS_VALUES Specifies the type of memory that you want to read into for the RAD_IOP asynchronous I/O functions.
RAD_IOP_READCALLBACK points to a function that will be called when the async read completes.
RAD_IOPQueueAsyncReadAtBottom queues an asynchronous read to be performed in the background at the lowest priority.
RAD_IOPGetIOStatus returns the error code from a failed IO request.
RAD_IOPCancelAsyncOpen cancels a previous asynchronous file open.
RAD_IOPCancelAsyncRead cancels a previous asynchronous file read.
RAD_IOPCancelFileAsyncs cancels all previous asynchronous file reads for a specified file handle.
RAD_IOPCancelGroupOfAsyncs cancels all previous asynchronous file opens and reads for a specified group id.
RAD_IOPCancelAllAsyncs cancels all previous asynchronous file opens and reads.
RAD_IOPCloseFile closes a file handle opened with RAD_IOPQueueAsyncOpenFile.
RAD_IOPRegisterSoundCallback registers a sound data structure to call your sound interrupt callback.
RAD_IOP_SOUND_DATA is a structure used to control a sound interrupt callback.
RAD_IOP_SOUNDCALLBACK points to a function that will be called periodically to fill a streaming sound buffer.
RAD_IOPStartSound starts calling a previously registered sound callback.
RAD_IOPPauseSound pauses a previously registered sound callback.
RAD_IOPUnregisterSoundCallback unregisters a sound callback.
RAD_IOPRegisterTimerCallback registers a timer structure to call your timer interrupt callback at a certain frequency.
RAD_IOP_TIMER_DATA is a structure used to call a timer interrupt callback.
RAD_IOP_TIMERCALLBACK points to a function that will be called periodically.
RAD_IOPStartTimer starts calling a previously registered timer callback.
RAD_IOPPauseTimer pauses a previously registered timer callback.
RAD_IOPUnregisterTimerCallback unregisters a timer callback.
RAD_IOPHardwareVolumes sets the sound core hardware volumes.
RADTimerRead returns a rolling millisecond timer.

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.